home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Internet Strate…Tools for the Enterprise / Microsoft Internet Strategy & Tools for the Enterprise.iso / content / devel.tls / icp / vbsamp / smplmail.exe / FRMMAIL.FRM (.txt) next >
Visual Basic Form  |  1996-03-26  |  27KB  |  643 lines

  1. VERSION 4.00
  2. Begin VB.Form frmMail 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Simple Internet Mail..."
  5.    ClientHeight    =   6375
  6.    ClientLeft      =   945
  7.    ClientTop       =   1500
  8.    ClientWidth     =   8370
  9.    Height          =   6780
  10.    Icon            =   "frmMail.frx":0000
  11.    Left            =   885
  12.    LinkTopic       =   "Form1"
  13.    LockControls    =   -1  'True
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   6375
  17.    ScaleWidth      =   8370
  18.    ShowInTaskbar   =   0   'False
  19.    Top             =   1155
  20.    Width           =   8490
  21.    Begin TabDlg.SSTab SSTab1 
  22.       Height          =   5655
  23.       Left            =   30
  24.       TabIndex        =   6
  25.       Top             =   420
  26.       Width           =   8355
  27.       _Version        =   65536
  28.       _ExtentX        =   14737
  29.       _ExtentY        =   9975
  30.       _StockProps     =   15
  31.       Caption         =   "Connection Settings"
  32.       TabsPerRow      =   3
  33.       Tab             =   0
  34.       TabOrientation  =   0
  35.       Tabs            =   3
  36.       Style           =   1
  37.       TabMaxWidth     =   0
  38.       TabHeight       =   423
  39.       TabCaption(0)   =   "Connection Settings"
  40.       Tab(0).ControlCount=   8
  41.       Tab(0).ControlEnabled=   -1  'True
  42.       Tab(0).Control(0)=   "Label1(0)"
  43.       Tab(0).Control(1)=   "Label1(1)"
  44.       Tab(0).Control(2)=   "Label1(2)"
  45.       Tab(0).Control(3)=   "Label1(3)"
  46.       Tab(0).Control(4)=   "txtPopServer"
  47.       Tab(0).Control(5)=   "txtUserID"
  48.       Tab(0).Control(6)=   "txtPassword"
  49.       Tab(0).Control(7)=   "txtSmtpServer"
  50.       TabCaption(1)   =   "Receive Mail"
  51.       Tab(1).ControlCount=   17
  52.       Tab(1).ControlEnabled=   0   'False
  53.       Tab(1).Control(0)=   "Label1(15)"
  54.       Tab(1).Control(1)=   "Label1(14)"
  55.       Tab(1).Control(2)=   "Label1(13)"
  56.       Tab(1).Control(3)=   "Label1(12)"
  57.       Tab(1).Control(4)=   "Label1(10)"
  58.       Tab(1).Control(5)=   "Label1(8)"
  59.       Tab(1).Control(6)=   "Label1(9)"
  60.       Tab(1).Control(7)=   "lblFirst"
  61.       Tab(1).Control(8)=   "Label1(11)"
  62.       Tab(1).Control(9)=   "lblLast"
  63.       Tab(1).Control(10)=   "txtPOPSubject"
  64.       Tab(1).Control(11)=   "txtPOPCc"
  65.       Tab(1).Control(12)=   "txtPOPTo"
  66.       Tab(1).Control(13)=   "txtPOPReceived"
  67.       Tab(1).Control(14)=   "txtPOPFrom"
  68.       Tab(1).Control(15)=   "txtDownload"
  69.       Tab(1).Control(16)=   "txtMessageID"
  70.       TabCaption(2)   =   "Send Mail"
  71.       Tab(2).ControlCount=   9
  72.       Tab(2).ControlEnabled=   0   'False
  73.       Tab(2).Control(0)=   "txtSubject"
  74.       Tab(2).Control(1)=   "txtFrom"
  75.       Tab(2).Control(2)=   "txtCc"
  76.       Tab(2).Control(3)=   "txtTo"
  77.       Tab(2).Control(4)=   "txtSendBody"
  78.       Tab(2).Control(5)=   "Label1(7)"
  79.       Tab(2).Control(6)=   "Label1(6)"
  80.       Tab(2).Control(7)=   "Label1(5)"
  81.       Tab(2).Control(8)=   "Label1(4)"
  82.       Begin VB.TextBox txtSmtpServer 
  83.          Height          =   285
  84.          Left            =   1665
  85.          TabIndex        =   3
  86.          Top             =   1530
  87.          Width           =   3030
  88.       End
  89.       Begin VB.TextBox txtPassword 
  90.          Height          =   285
  91.          Left            =   1665
  92.          PasswordChar    =   "*"
  93.          TabIndex        =   2
  94.          Top             =   930
  95.          Width           =   3030
  96.       End
  97.       Begin VB.TextBox txtUserID 
  98.          Height          =   285
  99.          Left            =   1665
  100.          TabIndex        =   1
  101.          Top             =   630
  102.          Width           =   3030
  103.       End
  104.       Begin VB.TextBox txtPopServer 
  105.          Height          =   285
  106.          Left            =   1665
  107.          TabIndex        =   0
  108.          Top             =   330
  109.          Width           =   3030
  110.       End
  111.       Begin VB.TextBox txtMessageID 
  112.          Height          =   285
  113.          Left            =   -67380
  114.          TabIndex        =   17
  115.          Top             =   610
  116.          Width           =   630
  117.       End
  118.       Begin VB.TextBox txtDownload 
  119.          Height          =   3780
  120.          Left            =   -74970
  121.          MultiLine       =   -1  'True
  122.          ScrollBars      =   3  'Both
  123.          TabIndex        =   16
  124.          TabStop         =   0   'False
  125.          Top             =   1810
  126.          Width           =   8235
  127.       End
  128.       Begin VB.TextBox txtPOPFrom 
  129.          Height          =   285
  130.          Left            =   -74070
  131.          TabIndex        =   13
  132.          TabStop         =   0   'False
  133.          Top             =   910
  134.          Width           =   5430
  135.       End
  136.       Begin VB.TextBox txtPOPReceived 
  137.          Height          =   285
  138.          Left            =   -74070
  139.          TabIndex        =   14
  140.          TabStop         =   0   'False
  141.          Top             =   1210
  142.          Width           =   5430
  143.       End
  144.       Begin VB.TextBox txtPOPTo 
  145.          Height          =   285
  146.          Left            =   -74070
  147.          TabIndex        =   11
  148.          TabStop         =   0   'False
  149.          Top             =   310
  150.          Width           =   5430
  151.       End
  152.       Begin VB.TextBox txtPOPCc 
  153.          Height          =   285
  154.          Left            =   -74070
  155.          TabIndex        =   12
  156.          TabStop         =   0   'False
  157.          Top             =   610
  158.          Width           =   5430
  159.       End
  160.       Begin VB.TextBox txtPOPSubject 
  161.          Height          =   285
  162.          Left            =   -74070
  163.          TabIndex        =   15
  164.          TabStop         =   0   'False
  165.          Top             =   1510
  166.          Width           =   7320
  167.       End
  168.       Begin VB.TextBox txtSubject 
  169.          Height          =   285
  170.          Left            =   -74070
  171.          TabIndex        =   25
  172.          Top             =   1245
  173.          Width           =   5430
  174.       End
  175.       Begin VB.TextBox txtFrom 
  176.          Height          =   315
  177.          Left            =   -74070
  178.          TabIndex        =   23
  179.          Top             =   915
  180.          Width           =   5430
  181.       End
  182.       Begin VB.TextBox txtCc 
  183.          Height          =   285
  184.          Left            =   -74070
  185.          TabIndex        =   21
  186.          Top             =   615
  187.          Width           =   5430
  188.       End
  189.       Begin VB.TextBox txtTo 
  190.          Height          =   285
  191.          Left            =   -74070
  192.          TabIndex        =   19
  193.          Top             =   315
  194.          Width           =   5430
  195.       End
  196.       Begin VB.TextBox txtSendBody 
  197.          Height          =   4050
  198.          Left            =   -74940
  199.          MultiLine       =   -1  'True
  200.          ScrollBars      =   3  'Both
  201.          TabIndex        =   27
  202.          Top             =   1545
  203.          Width           =   8235
  204.       End
  205.       Begin VB.Label Label1 
  206.          AutoSize        =   -1  'True
  207.          Caption         =   "SMTP &Server:"
  208.          Height          =   195
  209.          Index           =   3
  210.          Left            =   600
  211.          TabIndex        =   36
  212.          Top             =   1575
  213.          Width           =   1005
  214.       End
  215.       Begin VB.Label Label1 
  216.          AutoSize        =   -1  'True
  217.          Caption         =   "Password:"
  218.          Height          =   195
  219.          Index           =   2
  220.          Left            =   885
  221.          TabIndex        =   35
  222.          Top             =   975
  223.          Width           =   750
  224.       End
  225.       Begin VB.Label Label1 
  226.          AutoSize        =   -1  'True
  227.          Caption         =   "User ID:"
  228.          Height          =   195
  229.          Index           =   1
  230.          Left            =   1035
  231.          TabIndex        =   34
  232.          Top             =   675
  233.          Width           =   585
  234.       End
  235.       Begin VB.Label Label1 
  236.          AutoSize        =   -1  'True
  237.          Caption         =   "POP Server:"
  238.          Height          =   195
  239.          Index           =   0
  240.          Left            =   750
  241.          TabIndex        =   33
  242.          Top             =   375
  243.          Width           =   885
  244.       End
  245.       Begin VB.Label lblLast 
  246.          BorderStyle     =   1  'Fixed Single
  247.          Caption         =   "0"
  248.          Height          =   285
  249.          Left            =   -67380
  250.          TabIndex        =   32
  251.          Top             =   915
  252.          Width           =   630
  253.       End
  254.       Begin VB.Label Label1 
  255.          AutoSize        =   -1  'True
  256.          Caption         =   "Last Msg Id:"
  257.          Height          =   195
  258.          Index           =   11
  259.          Left            =   -68265
  260.          TabIndex        =   31
  261.          Top             =   955
  262.          Width           =   870
  263.       End
  264.       Begin VB.Label lblFirst 
  265.          BorderStyle     =   1  'Fixed Single
  266.          Caption         =   "0"
  267.          Height          =   285
  268.          Left            =   -67380
  269.          TabIndex        =   30
  270.          Top             =   315
  271.          Width           =   630
  272.       End
  273.       Begin VB.Label Label1 
  274.          AutoSize        =   -1  'True
  275.          Caption         =   "First Msg Id:"
  276.          Height          =   195
  277.          Index           =   9
  278.          Left            =   -68250
  279.          TabIndex        =   29
  280.          Top             =   355
  281.          Width           =   855
  282.       End
  283.       Begin VB.Label Label1 
  284.          AutoSize        =   -1  'True
  285.          Caption         =   "Current:"
  286.          Height          =   195
  287.          Index           =   8
  288.          Left            =   -67950
  289.          TabIndex        =   28
  290.          Top             =   655
  291.          Width           =   555
  292.       End
  293.       Begin VB.Label Label1 
  294.          AutoSize        =   -1  'True
  295.          Caption         =   "From:"
  296.          Height          =   195
  297.          Index           =   10
  298.          Left            =   -74505
  299.          TabIndex        =   26
  300.          Top             =   955
  301.          Width           =   405
  302.       End
  303.       Begin VB.Label Label1 
  304.          AutoSize        =   -1  'True
  305.          Caption         =   "Received:"
  306.          Height          =   195
  307.          Index           =   12
  308.          Left            =   -74835
  309.          TabIndex        =   24
  310.          Top             =   1255
  311.          Width           =   750
  312.       End
  313.       Begin VB.Label Label1 
  314.          AutoSize        =   -1  'True
  315.          Caption         =   "To:"
  316.          Height          =   195
  317.          Index           =   13
  318.          Left            =   -74355
  319.          TabIndex        =   22
  320.          Top             =   355
  321.          Width           =   240
  322.       End
  323.       Begin VB.Label Label1 
  324.          AutoSize        =   -1  'True
  325.          Caption         =   "Cc:"
  326.          Height          =   195
  327.          Index           =   14
  328.          Left            =   -74370
  329.          TabIndex        =   20
  330.          Top             =   655
  331.          Width           =   225
  332.       End
  333.       Begin VB.Label Label1 
  334.          AutoSize        =   -1  'True
  335.          Caption         =   "Subject:"
  336.          Height          =   195
  337.          Index           =   15
  338.          Left            =   -74670
  339.          TabIndex        =   18
  340.          Top             =   1555
  341.          Width           =   570
  342.       End
  343.       Begin VB.Label Label1 
  344.          AutoSize        =   -1  'True
  345.          Caption         =   "Su&bject:"
  346.          Height          =   195
  347.          Index           =   7
  348.          Left            =   -74670
  349.          TabIndex        =   10
  350.          Top             =   1275
  351.          Width           =   585
  352.       End
  353.       Begin VB.Label Label1 
  354.          AutoSize        =   -1  'True
  355.          Caption         =   "&From:"
  356.          Height          =   195
  357.          Index           =   6
  358.          Left            =   -74490
  359.          TabIndex        =   9
  360.          Top             =   945
  361.          Width           =   390
  362.       End
  363.       Begin VB.Label Label1 
  364.          AutoSize        =   -1  'True
  365.          Caption         =   "&Cc:"
  366.          Height          =   195
  367.          Index           =   5
  368.          Left            =   -74340
  369.          TabIndex        =   8
  370.          Top             =   645
  371.          Width           =   240
  372.       End
  373.       Begin VB.Label Label1 
  374.          AutoSize        =   -1  'True
  375.          Caption         =   "&To:"
  376.          Height          =   195
  377.          Index           =   4
  378.          Left            =   -74340
  379.          TabIndex        =   7
  380.          Top             =   345
  381.          Width           =   240
  382.       End
  383.    End
  384.    Begin ComctlLib.StatusBar Status 
  385.       Align           =   2  'Align Bottom
  386.       Height          =   285
  387.       Left            =   0
  388.       TabIndex        =   5
  389.       Top             =   6090
  390.       Width           =   8370
  391.       _Version        =   65536
  392.       _ExtentX        =   14774
  393.       _ExtentY        =   508
  394.       _StockProps     =   68
  395.       AlignSet        =   -1  'True
  396.       SimpleText      =   ""
  397.       NumPanels       =   3
  398.       i1              =   "frmMail.frx":014A
  399.       i2              =   "frmMail.frx":0238
  400.       i3              =   "frmMail.frx":0326
  401.    End
  402.    Begin POPCTLib.POPCT POP 
  403.       Left            =   8490
  404.       Top             =   1110
  405.       _ExtentX        =   847
  406.       _ExtentY        =   847
  407.       RemoteHost      =   "127.0.0.1"
  408.       RemotePort      =   110
  409.       ConnectTimeout  =   0
  410.       RecvTimeout     =   0
  411.       NotificationMode=   1
  412.       UserId          =   ""
  413.       Password        =   ""
  414.       TopLines        =   0
  415.    End
  416.    Begin SMTPCTLib.smtpct SMTP 
  417.       Left            =   8490
  418.       Top             =   1650
  419.       _ExtentX        =   847
  420.       _ExtentY        =   847
  421.       RemoteHost      =   "mail"
  422.       RemotePort      =   25
  423.       ConnectTimeout  =   0
  424.       RecvTimeout     =   0
  425.       NotificationMode=   0
  426.    End
  427.    Begin ComctlLib.Toolbar Tools 
  428.       Align           =   1  'Align Top
  429.       Height          =   390
  430.       Left            =   0
  431.       TabIndex        =   4
  432.       Top             =   0
  433.       Width           =   8370
  434.       _Version        =   65536
  435.       _ExtentX        =   14764
  436.       _ExtentY        =   688
  437.       _StockProps     =   96
  438.       ImageList       =   "Images"
  439.       NumButtons      =   8
  440.       i1              =   "frmMail.frx":0432
  441.       i2              =   "frmMail.frx":05D1
  442.       i3              =   "frmMail.frx":0784
  443.       i4              =   "frmMail.frx":095B
  444.       i5              =   "frmMail.frx":0AFA
  445.       i6              =   "frmMail.frx":0CC5
  446.       i7              =   "frmMail.frx":0E6C
  447.       i8              =   "frmMail.frx":100B
  448.       AlignSet        =   -1  'True
  449.    End
  450.    Begin ComctlLib.ImageList Images 
  451.       Left            =   8430
  452.       Top             =   2220
  453.       _Version        =   65536
  454.       _ExtentX        =   1005
  455.       _ExtentY        =   1005
  456.       _StockProps     =   1
  457.       BackColor       =   -2147483643
  458.       ImageWidth      =   16
  459.       ImageHeight     =   16
  460.       MaskColor       =   12632256
  461.       NumImages       =   5
  462.       i1              =   "frmMail.frx":11DA
  463.       i2              =   "frmMail.frx":1599
  464.       i3              =   "frmMail.frx":1958
  465.       i4              =   "frmMail.frx":1B57
  466.       i5              =   "frmMail.frx":1D56
  467.    End
  468. Attribute VB_Name = "frmMail"
  469. Attribute VB_Creatable = False
  470. Attribute VB_Exposed = False
  471. Option Explicit
  472. '---------------------------------------------------------------
  473. ' [Tools.Buttons collection button index constants...]
  474. '---------------------------------------------------------------
  475. Const btnPOPCONNECT = 2                                 ' POP connect button
  476. Const btnPOPDISCONNECT = 3                              ' POP disconnect button
  477. Const btnPOPRECEIVE = 5                                 ' POP receive button
  478. Const btnSMTPSEND = 6                                   ' SMTP send button
  479. Const btnPOPREFRESH = 8                                 ' POP refresh button...
  480. '---------------------------------------------------------------
  481. Private Sub POP_Authenticate()
  482. '---------------------------------------------------------------
  483.     Dim Count As Long                                   ' Message count variable...
  484. '---------------------------------------------------------------
  485.     Count = POP.MessageCount                            ' Get message count from Pop server
  486.     If (Count > 0) Then                                 ' If messages available then...
  487.         lblFirst.Caption = "1"                          ' Update ui
  488.         lblLast.Caption = Format(Count, "0")            ' ...
  489.         txtMessageId.Text = "1"                         ' ...
  490.     Else                                                ' no messages
  491.         lblFirst.Caption = "0"                          ' show all 0's
  492.         lblLast.Caption = "0"                           '
  493.         txtMessageId.Text = ""                          '
  494.     End If
  495. '---------------------------------------------------------------
  496. End Sub
  497. '---------------------------------------------------------------
  498. '---------------------------------------------------------------
  499. Private Sub POP_DocOutput(ByVal DocOutput As DocOutput)
  500. '---------------------------------------------------------------
  501.     Dim msg As Variant                                  ' GetData output variable
  502.     Dim Hdr As DocHeader                                ' Header object variable
  503. '---------------------------------------------------------------
  504.     Select Case DocOutput.State                         ' Determine current download state
  505.     Case icDocBegin                                     ' [Beginning download - no data yet...]
  506.         Status.Panels.Item(3).Text = "POP3: Download Started." ' Update status
  507.         txtDownload.Text = ""                           ' Clear text boxes...
  508.         txtPOPFrom.Text = ""
  509.         txtPOPReceived.Text = ""
  510.         txtPOPTo.Text = ""
  511.         txtPOPCc.Text = ""
  512.         txtPOPSubject.Text = ""
  513.     Case icDocHeaders                                   ' [Downloading MIME-headers - only in headers collection]
  514.         Status.Panels.Item(3).Text = "POP3: Downloading Headers...[" & _
  515.                                      CStr(DocOutput.Headers.Count) & "]" ' Update status
  516.         For Each Hdr In DocOutput.Headers               ' look at each header in the headers collection
  517.             Select Case LCase(Hdr.Name)                 ' determine MIME-Header type...
  518.             Case "from"                                 ' MIME-type: From
  519.                 txtPOPFrom.Text = Hdr.Value
  520.             Case "date"                                 ' MIME-type: Date
  521.                 txtPOPReceived.Text = Hdr.Value
  522.             Case "to"                                   ' MIME-type: To
  523.                 txtPOPTo.Text = Hdr.Value
  524.             Case "cc"                                   ' MIME-type: Cc
  525.                 txtPOPCc.Text = Hdr.Value
  526.             Case "subject"                              ' MIME-type: Subject
  527.                 txtPOPSubject.Text = Hdr.Value
  528.             Case Else                                   ' MIME-type: etc...
  529.                 txtDownload.Text = txtDownload.Text & _
  530.                                    Hdr.Name & ": " & Hdr.Value & vbCrLf ' Stick the rest into the message body
  531.             End Select
  532.         Next                                            ' Get next header
  533.     Case icDocData                                      ' [Downloading data - message body...]
  534.         DocOutput.GetData msg                           ' Get data from DocOutput object
  535.         Status.Panels.Item(3).Text = "POP3: Downloading Data..." ' Update status
  536.         txtDownload.Text = txtDownload.Text & msg       ' Add message to text box
  537.     Case icDocEnd                                       ' [Data Download Complete]
  538.         Status.Panels.Item(3).Text = "POP3: Download Complete." ' Update status
  539.     Case icDocError                                     ' [Error in download.]
  540.         Status.Panels.Item(3).Text = "POP3: Download Error." ' Update status
  541.     Case icDocNone                                      ' [???]
  542.     End Select
  543. '---------------------------------------------------------------
  544. End Sub
  545. '---------------------------------------------------------------
  546. '---------------------------------------------------------------
  547. Private Sub POP_StateChanged(ByVal State As Integer)
  548. '---------------------------------------------------------------
  549.     Tools.Buttons(btnPOPDISCONNECT).Enabled = (State <> prcDisconnected) ' Enable disconnect if not disconnected
  550.     Tools.Buttons(btnPOPRECEIVE).Enabled = (State = prcConnected)        ' Enable pop receive button if connected
  551.     Status.Panels.Item(1).Text = "POP3: " & POP.StateString              ' Update status
  552. '---------------------------------------------------------------
  553. End Sub
  554. '---------------------------------------------------------------
  555. '---------------------------------------------------------------
  556. Private Sub POP_ProtocolStateChanged(ByVal ProtocolState As Integer)
  557. '---------------------------------------------------------------
  558.     Tools.Buttons(btnPOPREFRESH).Enabled = (ProtocolState = prcTransaction) ' Enable pop refresh if connected and validated only...
  559.     Status.Panels.Item(2).Text = "POP3: " & POP.ProtocolStateString     ' update status
  560.     Select Case ProtocolState                               ' Determine current POP protocol state
  561.     Case prcNone                                            ' ?
  562.     Case prcAuthorization                                   ' POP protocol requesting authentication from client...
  563.         POP.Authenticate txtUserID.Text, txtPassword.Text   ' Send authentication...
  564.     Case prcTransaction                                     ' POP protocol ready for transactions...
  565.     Case prcUpdate                                          ' POP protocol is currently changing
  566.     End Select
  567. '---------------------------------------------------------------
  568. End Sub
  569. '---------------------------------------------------------------
  570. '---------------------------------------------------------------
  571. Private Sub SMTP_DocInput(ByVal DocInput As DocInput)
  572. '---------------------------------------------------------------
  573.     Select Case DocInput.State                              ' Determine current state of DocInput transaction
  574.     Case icDocBegin                                         ' [Beginning transaction to SMTP server]
  575.         Status.Panels.Item(3).Text = "SMTP: Send Start."
  576.     Case icDocHeaders                                       ' [Sending headers to SMTP server]
  577.         Status.Panels.Item(3).Text = "SMTP: Sending Headers..."
  578.     Case icDocData                                          ' [Sending data to SMTP serve]
  579.         Status.Panels.Item(3).Text = "SMTP: Sending Data..."
  580.     Case icDocEnd                                           ' [End of transaction]
  581.         Status.Panels.Item(3).Text = "SMTP: Send Complete."
  582.     Case icDocError                                         ' [Error in transaction]
  583.         Status.Panels.Item(3).Text = "SMTP: Send Error."
  584.     Case icDocNone                                          '[?]
  585.     End Select
  586. '---------------------------------------------------------------
  587. End Sub
  588. '---------------------------------------------------------------
  589. Private Sub SMTP_StateChanged(ByVal State As Integer)
  590.     Status.Panels.Item(1).Text = "SMTP: " & SMTP.StateString         ' Update status
  591. End Sub
  592. Private Sub SMTP_ProtocolStateChanged(ByVal ProtocolState As Integer)
  593.     Status.Panels.Item(2).Text = "SMTP: " & SMTP.ProtocolStateString ' Update status
  594. End Sub
  595. '------------------------------------------------------------
  596. Private Sub Tools_ButtonClick(ByVal Button As Button)
  597. '------------------------------------------------------------
  598.     Dim HDRs As DocHeaders                              ' DocHeaders collection used to send mail message to SMTP server
  599.     Dim Count As Long                                   ' POP message count variable
  600. '------------------------------------------------------------
  601.     Select Case Button.Index                            ' Determine the button that was clicked on tool bar
  602.     Case btnPOPCONNECT                                  ' [POP Connect]
  603.         POP.Connect txtPopServer.Text                   ' Connect to server
  604.     Case btnPOPDISCONNECT                               ' [POP Disconnect]
  605.         POP.Quit                                        ' Disconnect from server
  606.     Case btnPOPRECEIVE                                  ' [POP Receive]
  607.         POP.RetrieveMessage Val(txtMessageId.Text)      ' Download\Receive mail message
  608.     Case btnSMTPSEND                                    ' [SMTP Send]
  609.         SMTP.RemoteHost = txtSmtpServer.Text            ' Set name of SMTP server to RemoteHost
  610.         
  611.         Set HDRs = SMTP.DocInput.Headers                ' Copy SMTP DocInputHeaders collection
  612.         HDRs.Clear                                      ' Clear headers collection
  613.         HDRs.Add "To", txtTo.Text                       ' Add... MIME-header: To
  614.         HDRs.Add "CC", txtCc.Text                       ' Add... MIME-header: Cc
  615.         HDRs.Add "From", txtFrom.Text                   ' Add... MIME-header: From
  616.         HDRs.Add "Subject", txtSubject.Text             ' Add... MIME-header: Subject
  617.         HDRs.Add "Message-Id", "<" & App.Title & _
  618.                                "." & Format(Date) & _
  619.                                "." & Format(Timer) & _
  620.                                "." & txtFrom.Text & ">" ' Add... MIME-header: Message-Id
  621.                                
  622.         HDRs.Add "Content-Type", "TEXT/PLAIN; charset=US-ASCII"     ' Add... MIME-header: Content-Type
  623.         HDRs.Add "Content-Length", " " & Len(txtSendBody.Text) + 2  ' Add... MIME-header: Content-Length
  624.         
  625.         SMTP.SendDoc , HDRs, txtSendBody.Text           ' Send mail to SMTP server
  626.     Case btnPOPREFRESH                                  ' Tell POP server to reset info
  627.         POP.Reset                                       ' Call reset
  628.         Count = POP.MessageCount                        ' Get current POP remote mail count
  629.         
  630.         If (Count > 0) Then                             ' If any messages exist...
  631.             lblFirst.Caption = "1"                      ' Update UI
  632.             lblLast.Caption = Format(Count, "0")
  633.             txtMessageId.Text = "1"
  634.         Else                                            ' Else no messages exist
  635.             lblFirst.Caption = "0"                      ' Update UI...
  636.             lblLast.Caption = "0"
  637.             txtMessageId.Text = ""
  638.         End If
  639.     End Select
  640. '------------------------------------------------------------
  641. End Sub
  642. '------------------------------------------------------------
  643.